<template>
  <div>
    <router-view/>
  </div>
</template>

<script setup>
import {ref, onMounted,nextTick} from "vue";
// 禁止缩放
const prohibitScaling = () => {
  const keyCodeMap = {
    // 91: true, // command
    61: true,
    107: true, // 数字键盘 +
    109: true, // 数字键盘 -
    173: true, // 火狐 - 号
    187: true, // +
    189: true // -
  }
  // 覆盖ctrl||command + ‘+’/‘-’
  document.onkeydown = function (event) {
    const e = event || window.event
    const ctrlKey = e.ctrlKey || e.metaKey
    if (ctrlKey && keyCodeMap[e.keyCode]) {
      e.preventDefault()
    } else if (e.detail) { // Firefox
      event.returnValue = false
    }
  }
  // 覆盖鼠标滑动
  document.body.addEventListener('wheel', (e) => {
    if (e.ctrlKey) {
      if (e.deltaY < 0) {
        e.preventDefault()
        return false
      }
      if (e.deltaY > 0) {
        e.preventDefault()
        return false
      }
    }
  }, {passive: false})
}
onMounted(() => {
  prohibitScaling()
  // console.log('window.innerHeight',window.innerHeight)
})
const widthArr = ['1921','2559','3840'];
const heightArr = ['1080','1440','2160'];
addEventListener('resize', () => {
  if(widthArr.indexOf(String(window.innerWidth)) > -1 || heightArr.indexOf(String(window.innerHeight)) > -1){
    let num = window.innerWidth / window.innerHeight * 12
    document.querySelector('html').style.fontSize = num + 'px';
  }
})
</script>